home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Frameworks / Argus Frameworks 2.1 / Argus Libraries 2.1 / FnError.cp < prev    next >
Text File  |  1995-06-23  |  2KB  |  72 lines

  1. /**********************************************************************
  2.  
  3.     FnError.cp
  4.  
  5. ***********************************************************************/
  6.  
  7. /*
  8.     Provides a very simple error dialog in the center of the screen.
  9.     You have the option of immediately quitting application after user
  10.     clicks OK.
  11.     
  12.     Functions Include:
  13.     
  14.       FnErr_DisplayStrID      Display error using string ID
  15.       FnErr_DisplayStr        Display error string
  16. */
  17.  
  18. /********** Available Error ID's */
  19. const short kGeneralError =    900;
  20. const short kBadSystem =       901;
  21. const short kNoResource =      902;
  22. const short kAppleEventError = 903;
  23.  
  24. /********** Constants */
  25. const short kErrorAlert = 900;
  26. #define kNilPtr     0L
  27. #define kNilStr     "\p"
  28. #define kFatalError "\pFatal Error!"
  29.  
  30. /********** Prototypes */
  31. void FnErr_DisplayStrID( int    stringNum,
  32.                          int    quitFlag );
  33. void FnErr_DisplayStr(   Str255 s1,
  34.                          Str255 s2,
  35.                          Str255 s3,
  36.                          Str255 s4,
  37.                          int    quitFlag );
  38.  
  39. /********** DisplayStrID */
  40.  
  41. void FnErr_DisplayStrID( int stringNum, int quitFlag )
  42. {
  43.     StringHandle   errorStringH;
  44.     
  45.     if ( ( errorStringH = GetString( stringNum ) ) == kNilPtr )
  46.         ParamText( kFatalError, kNilStr, kNilStr, kNilStr );
  47.     else
  48.     {
  49.         HLock( (Handle)errorStringH );
  50.         ParamText( *errorStringH, kNilStr, kNilStr, kNilStr );
  51.         HUnlock( (Handle)errorStringH );
  52.     }
  53.     StopAlert( kErrorAlert, kNilPtr );
  54.     if( quitFlag )
  55.         ExitToShell();
  56. }
  57.  
  58. /********** DisplayStr */
  59.  
  60. void FnErr_DisplayStr(   Str255 s1,
  61.                          Str255 s2,
  62.                          Str255 s3,
  63.                          Str255 s4,
  64.                          int    quitFlag )
  65. {
  66.     ParamText( s1, s2, s3, s4 );
  67.     StopAlert( kErrorAlert, kNilPtr );
  68.     if( quitFlag )
  69.         ExitToShell();
  70. }
  71.  
  72. // End of File